// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2004-6-21

#ifndef __WND_H_COMMON_UI__
#define __WND_H_COMMON_UI__

#pragma once

#include "ctrl.h"

//##ModelId=44CF17B50290
class CJoyWnd : public CWnd, public CJoyCtrl
{
	DECLARE_DYNAMIC(CJoyWnd)
protected:

	//##ModelId=44CF17B50293
    bool        m_needDraw;
    //bool        m_hovered;
    //CJoyCtrl*   m_hoveredCtrl;
    //CJoyCtrl*   m_captureCtrl;
    //CJoyCtrl*   m_activeCtrl;

	//##ModelId=44CF17B5029F
    void DoTrackMouseLeave(bool bTrack);
	//##ModelId=44CF17B502A1
    void DoMouseMessage(MouseMessage msg, const CPoint& pt);
	//##ModelId=44CF17B502AF
    LRESULT DoHitTest(const CPoint& pt);
	//##ModelId=44CF17B502B1
    virtual void DoAlignChilds(CRect& remain);

	//##ModelId=44CF17B502B4
    virtual void CM_LoadSkin(CJoyXmlElement* pSkinElem);
	//##ModelId=44CF17B502C0
    virtual void CM_Visible(bool v);

public:
	//##ModelId=44CF17B502C3
    CJoyWnd(void);
	//##ModelId=44CF17B502CE
    virtual ~CJoyWnd(void);
	//##ModelId=44CF17B502DE
    void InvalidateCtrl()
    {
        InvalidateCtrl(CRect(0, 0, m_area.Width(), m_area.Height()));
    }

	//##ModelId=44CF17B502DF
    void GetClientArea(CRect& area);
	//##ModelId=44CF17B502E1
    virtual bool Create(CWnd* parent, const CRect& area);

	//##ModelId=44CF17B502EE
    virtual void SetVisible(bool v);
	//##ModelId=44CF17B502F1
    virtual void NotifyAlign();
	//##ModelId=44CF17B502FD
    virtual void LoadSkin(CJoyXmlElement* pSkinElem);
	//##ModelId=44CF17B50300
    virtual bool IsWnd();
	//##ModelId=44CF17B5030D
    virtual void AlignChilds();
	//##ModelId=44CF17B5030F
    virtual void SetArea(const CRect& area);
	//##ModelId=44CF17B50312
    virtual void SetArea(const CRect& area, bool bRepaint);
	//##ModelId=44CF17B5031D
    virtual void Destroy();
	//##ModelId=44CF17B5031F
    virtual void InvalidateCtrl(const CRect& area);
	//##ModelId=44CF17B5032C
    virtual void SetCtrlCapture(CJoyCtrl* pCtrl);
	//##ModelId=44CF17B5032F
    virtual void ReleaseCtrlCapture(CJoyCtrl* pCtrl);
	//##ModelId=44CF17B5033C
    virtual void SetAlign(AlignType align);
	//##ModelId=44CF17B5033F
    virtual void SetEnabled(bool e);
	//##ModelId=44CF17B5034B
    virtual void CtrlToScreen(CPoint& pt);

public:
	//##ModelId=44CF17B5034E
    LRESULT WMMouseLeave(WPARAM wParam, LPARAM lParam);
public:
    DECLARE_MESSAGE_MAP()
	//##ModelId=44CF17B5035C
    afx_msg HRESULT OnNotifyAlign(WPARAM, LPARAM);
	//##ModelId=44CF17B50360
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	//##ModelId=44CF17B50363
    afx_msg void OnDestroy();
	//##ModelId=44CF17B5036B
    afx_msg void OnPaint();
	//##ModelId=44CF17B5036D
    afx_msg void OnSize(UINT nType, int cx, int cy);
	//##ModelId=44CF17B50372
    afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
	//##ModelId=44CF17B50376
    afx_msg LRESULT OnNcHitTest(CPoint point);
	//##ModelId=44CF17B5037C
    afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	//##ModelId=44CF17B50380
    afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	//##ModelId=44CF17B50384
    afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	//##ModelId=44CF17B5038B
    afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
	//##ModelId=44CF17B5038F
    afx_msg void OnEnable(BOOL bEnable);
	//##ModelId=44CF17B50392
    afx_msg void OnSetFocus(CWnd* pOldWnd);
	//##ModelId=44CF17B50395
    afx_msg void OnMove(int x, int y);
	//##ModelId=44CF17B5039B
    afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	//##ModelId=44CF17B5039F
    afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
};

#endif  // __WND_H_COMMON_UI__
